# Maintainer: Brett Cornwall <ainola@archlinux.org>
# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
# Contributor: Drew DeVault

pkgname=mako
pkgver=1.8.0
pkgrel=1
license=('MIT')
pkgdesc='Lightweight notification daemon for Wayland'
makedepends=("meson" "scdoc" "systemd" "wayland-protocols")
depends=(
	"gdk-pixbuf2"
	"pango"
	"systemd-libs"
	"wayland"
)
optdepends=("jq: support for 'makoctl menu'")
arch=("loong64" "x86_64")
url='https://mako-project.org'
source=(
	"$pkgname-$pkgver.tar.gz::https://github.com/emersion/mako/releases/download/v$pkgver/mako-$pkgver.tar.gz"
	"$pkgname-$pkgver.tar.gz.sig::https://github.com/emersion/mako/releases/download/v$pkgver/mako-$pkgver.tar.gz.sig"
	"systemd-dbus-activation.patch"
)
validpgpkeys=("34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48") # emersion
sha256sums=('f20ff74925d6876fc243c49cb45cdb849afd55611aa1640471020d191823e3bb'
            'SKIP'
            '4579a2673dcf2114779e10ed52d771f3930c2192e8e35d3e145163d9e0b45c20')

prepare() {
	patch -Np1 -i "$srcdir/systemd-dbus-activation.patch" -d "$pkgname-$pkgver"
}

build() {
	arch-meson \
		-Dbash-completions=true \
		-Dfish-completions=true \
		-Dzsh-completions=true \
		-Dsd-bus-provider=libsystemd \
		"$pkgname-$pkgver" build
	ninja -C build
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
	install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" "$pkgname-$pkgver/LICENSE"
	install -Dm644 -t "$pkgdir/usr/lib/systemd/user/" "$pkgname-$pkgver/contrib/systemd/mako.service"
}
